package com.itheima.controller;

import com.itheima.common.R;
import com.itheima.manager.OmsOrderManager;

import com.itheima.vo.OmsUpdateStatusParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class OmsOrderReturnApplyController {

    @Autowired
    OmsOrderManager omsOrderManager;

    @GetMapping("/returnApply/list")
    public R returnApplyByPage(@RequestParam(required = false) String createTime,
                               @RequestParam(required = false) String handleMan,
                               @RequestParam(required = false) String handleTime,
                               @RequestParam(required = false) Integer id,
                               @RequestParam Integer pageNum,
                               @RequestParam Integer pageSize,
                               @RequestParam(required = false) String receiverKeyword,
                               @RequestParam(required = false) Integer status){
        return omsOrderManager.returnApplyByPage(createTime,handleMan,handleTime,id,pageNum,pageSize,receiverKeyword,status);
    }

    @PostMapping("/returnApply/delete")
    public R returnApplyDelete(Integer[] ids){
        return omsOrderManager.returnApplyDelete(ids);
    }

    @GetMapping("/returnApply/{id}")
    public R returnApplyById(@PathVariable Integer id){
        return omsOrderManager.returnApplyById(id);
    }

    @PostMapping("/returnApply/update/status/{id}")
    public R returnApplyUpdate(@PathVariable Integer id,
                               @RequestBody OmsUpdateStatusParam statusParam){
        return omsOrderManager.returnApplyUpdate(id,statusParam);
    }
}
